package com.fpt.controller;

import java.util.HashSet;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fpt.bean.CourseBean;
import com.fpt.domain.Courses;
import com.fpt.service.LoadService;

@Controller
public class loadController {
	@Autowired
	LoadService LOADSERVICE;
	
	@RequestMapping(value = "/data", method = RequestMethod.GET)
	public @ResponseBody HashSet<String> doloaddata(){
		List<Courses> listAll = LOADSERVICE.doGetCourse();
		HashSet<String> set = new HashSet<String>();
		
		for(Courses listCourse:listAll){
			set.add(listCourse.getCourseId() +" " + listCourse.getCourseName());
		}
		return set;
	}

	
	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public String doLogin(){
		return "login";
	}
}
